<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:s="http://jboss.com/products/seam/taglib"
	template="/layout/template.xhtml">

	<ui:define name="body">
		<h:form id="userSearchForm">
			<h:panelGrid columns="3" cellpadding="0" cellspacing="0">
					<h:outputLabel for="prinicipal">Prinicipal</h:outputLabel>
					<h:outputLabel for="firstName">First Name</h:outputLabel>
					<h:outputLabel for="lastName">Last Name</h:outputLabel>
					
					<h:inputText id="prinicipal" title="Search For Prinicipal" 
						value="#{usersQuery.users.principal}" />
					<h:inputText id="firstName" title="Search For First Name" 
						value="#{usersQuery.users.firstName}" />
					<h:inputText id="lastName" title="Search For Last Name" 
						value="#{usersQuery.users.lastName}" />
			</h:panelGrid>
			<a4j:commandButton id="submit" value="Search"
				action="#{userSearch.userSearch()}" reRender="users,scroller"
				eventsQueue="users" />

			<rich:dataTable id="users" ajax="true" width="100%" rows="15"
				height="100%" reRender="scroller" value="#{usersDataModel}"
				var="user" selectionMode="single">
				<rich:column>
					<f:facet name="header">
						Prinicipal
					</f:facet>
					<h:outputText value="#{user.principal}" />
				</rich:column>
				
				<rich:column>
					<f:facet name="header">
						First Name
					</f:facet>
					<h:outputText value="#{user.firstName}" />
				</rich:column>

				<rich:column>
					<f:facet name="header">
						Last Name
					</f:facet>
					<h:outputText value="#{user.lastName}" />
				</rich:column>

				<rich:column>
					<f:facet name="header">
						Date Created
					</f:facet>
					<h:outputText value="#{user.dateCreated}" />
				</rich:column>

				<rich:column>
					<f:facet name="header">
						Date Modified
					</f:facet>
					<h:outputText value="#{user.dateModified}" />
				</rich:column>
				
				<rich:column>
					<f:facet name="header">
						Detial
					</f:facet>
					<a4j:commandLink value="Detial" action="#{userSearch.userUpdate()}">
						<f:param name="userId" value="#{user.userId}"></f:param>
					</a4j:commandLink>
				</rich:column>
			</rich:dataTable>
			<rich:datascroller id="scroller" for="users" maxPages="25" />
		</h:form>
	</ui:define>
</ui:composition>